package timerwheel

import (
	"sync"
	"time"
)

const (
	//最小一组数据的个数
	ArrayListMax = 1000
)

var (
	PoolListE  *sync.Pool
	PoolBucket *sync.Pool
)

func init() {
	PoolListE = &sync.Pool{
		New: func() any {
			return new(taskModel)
		},
	}
	PoolBucket = &sync.Pool{
		New: func() any {
			return new(bucket)
		},
	}
}

type ITimer interface {
	//一次任务 返回值(定时任务ID)
	OnceTimer(delayTime time.Duration, callback func(...interface{}), params ...interface{}) uint64
	//循环任务 返回值(定时任务ID)
	LoopTimer(intervalTime time.Duration, callback func(...interface{}), params ...interface{}) uint64

	//循环次数任务 返回值(定时任务ID)
	LoopTimerByCount(intervalTime time.Duration, loopCount int, callback func(...interface{}), params ...interface{}) uint64

	//循环延时任务 返回值(定时任务ID)
	LoopDelayTimer(delayTime time.Duration, intervalTime time.Duration, callback func(...interface{}), params ...interface{}) uint64

	//循环任务(毫秒) 返回值(定时任务ID)
	LoopDelayTimerByCount(delayTime time.Duration, intervalTime time.Duration, loopCount int, callback func(...interface{}), params ...interface{}) uint64
	//删除定时任务(非线程安全)
	DeleteTimerTask(timerTaskID uint64)
	//删除所有定时任务(非线程安全)
	DeleteAllTimerTask()
	//获取当前tick时间
	GetTickTime() time.Time
}
